package com.wshl.aijiuunion.controller.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.blankj.utilcode.util.ActivityUtils;
import com.blankj.utilcode.util.SPUtils;
import com.wshl.aijiuunion.BaseActivity;
import com.wshl.aijiuunion.GlobConstant;
import com.wshl.aijiuunion.R;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created buy 风凊扬 on 2019/11/13 0013
 */
public class SelectTypeActivity extends BaseActivity {
    @BindView(R.id.img_back)
    ImageView imgBack;
    @BindView(R.id.tv_top_title)
    TextView tvTopTitle;
    @BindView(R.id.ll_fengongsi)
    LinearLayout llFengongsi;
    @BindView(R.id.ll_daili)
    LinearLayout llDaili;
    @BindView(R.id.ll_yewu)
    LinearLayout llYewu;

    @Override
    protected int getLayoutResource() {
        return R.layout.activity_selecttype;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ButterKnife.bind(this);
        tvTopTitle.setText("申请合作");
        //1 分公司 2 代理 3 业务员 4门店
        String type = SPUtils.getInstance().getString(GlobConstant.TYPE);

        switch (type) {
            case "2":

                llFengongsi.setVisibility(View.VISIBLE);
                break;
            case "3":

                llFengongsi.setVisibility(View.VISIBLE);
                llDaili.setVisibility(View.VISIBLE);
                break;
            case "4":

            default:
                llFengongsi.setVisibility(View.VISIBLE);
                llDaili.setVisibility(View.VISIBLE);
                llYewu.setVisibility(View.VISIBLE);
                break;

        }

    }

    @OnClick({R.id.img_back, R.id.ll_fengongsi, R.id.ll_daili, R.id.ll_yewu})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.img_back:
                this.finish();
                break;
            case R.id.ll_fengongsi:

                startShengji(1);
                break;
            case R.id.ll_daili:
                startShengji(2);
                break;
            case R.id.ll_yewu:
                startShengji(3);
                break;
        }
    }

    private void startShengji(int type) {

        Intent intent = new Intent(this, ShengjiActivity.class);
        intent.putExtra("type", type + "");
        ActivityUtils.startActivity(intent);


    }
}
